﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using QuanLyThuVien.Business;

namespace QuanLyThuVien.Presentation
{
    public partial class frmTKeSach : Form
    {
        public frmTKeSach()
        {
            InitializeComponent();
        }
        DauSachBUS BusSach = new DauSachBUS();

        TacGiaBUS BusTG = new TacGiaBUS();

        NXBBUS BusNXB = new NXBBUS();

        PhieuMuonBUS BusPhieuMuon = new PhieuMuonBUS();

        private void frmTKeSach_Load(object sender, EventArgs e)
        {
            BusSach.LayDLLenDataGridView(dgTKSach);
            BusSach.LayDLLenDataGridView(dgTKSach1);
        }

        private void rbTG_CheckedChanged(object sender, EventArgs e)
        {
            cbThongKe.Items.Clear();
            cbThongKe.Text = "";
            BusTG.LoadLenCBTacGia(cbThongKe);
        }

        private void rbNXB_CheckedChanged(object sender, EventArgs e)
        {
            cbThongKe.Items.Clear();
            cbThongKe.Text = "";
            BusNXB.LoadLenCB(cbThongKe);
        }

        private void btnThongKe_Click(object sender, EventArgs e)
        {
            if (rbNXB.Checked == true)
            {
                BusSach.LoadLenDGThongKeSach(dgTKSach1, cbThongKe.Text);
            }
            if (rbTG.Checked == true)
            {
                BusSach.LoadLenDGTKSachTheoTG(dgTKSach1, cbThongKe.Text);
            }
        }

        private void rbTK1_CheckedChanged(object sender, EventArgs e)
        {
            BusPhieuMuon.LoadLenDataGridView(dgTKSach);
        }

        private void rbTK2_CheckedChanged(object sender, EventArgs e)
        {
            BusSach.ThongKeSachConInTV(dgTKSach);
        }

        private void rbTK3_CheckedChanged(object sender, EventArgs e)
        {
            BusSach.ThongKeSachTon(dgTKSach);
        }

        private void radioButton1_CheckedChanged(object sender, EventArgs e)
        {
            BusSach.LayDLLenDataGridView(dgTKSach);
        }

    }
}
